//
//  HWGameLiveRankListProtocol.swift
//  PlayWithProject
//
//  Created by 王昌健 on 2021/11/16.
//

import UIKit
import SwiftUI

class HWGameLiveRankListProtocol: NSObject {
    var models:[HWVoiceRoomRankListModel]?
}

extension HWGameLiveRankListProtocol:UITableViewDelegate,UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return models?.count ?? 0
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = HWGameLiveRankListCell.cellWithTableView(tableView: tableView)
        if indexPath.row == 0 {
            cell.numberLabel.textColor = .colorWithHexString(hexString: "#FD5C52")
        } else if indexPath.row == 1 {
            cell.numberLabel.textColor = .colorWithHexString(hexString: "#FE892C")
        } else if indexPath.row == 2 {
            cell.numberLabel.textColor = .colorWithHexString(hexString: "#F9BD48")
        } else {
            cell.numberLabel.textColor = .colorWithHexString(hexString: "#DFE1E4")
        }
        
        if indexPath.row < 9{
            cell.numberLabel.text = "0\(indexPath.row + 1)"
        }else{
            cell.numberLabel.text = "\(indexPath.row + 1)"
        }
        cell.model = models?[indexPath.row]
        return cell
    }
    
    
}
